Template selection after recording + Enhancement Refactoring #1109
Template selection after recording + Enhancement Refactoring #1109duckduckhero wants to merge 18 commits intomainfrom
Conversation
…ix-progress-template-selector
…ix-progress-template-selector
…late-after-recording
…late-after-recording
…late-after-recording
…late-after-recording
📝 WalkthroughWalkthroughThe changes introduce a user-selectable "auto enhance template" feature for recording sessions, refactor enhancement logic to pass template IDs explicitly, remove global config mutation and restoration during enhancement, and update localization metadata. State management and UI are adjusted to support template selection, and relevant store and mutation interfaces are updated accordingly. Changes
Sequence Diagram(s)sequenceDiagram
participant User
participant RecordingControls
participant OngoingSessionStore
participant EditorArea
participant useEnhanceMutation
User->>RecordingControls: Stop recording (selects template)
RecordingControls->>OngoingSessionStore: setAutoEnhanceTemplate(templateId)
RecordingControls->>EditorArea: Trigger enhancement
EditorArea->>useEnhanceMutation: mutate({ triggerType: "auto", templateId })
useEnhanceMutation-->>EditorArea: Enhancement complete
Possibly related PRs
✨ Finishing Touches
Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out. 🪧 TipsChatThere are 3 ways to chat with CodeRabbit:
SupportNeed help? Create a ticket on our support page for assistance with any issues or questions. Note: Be mindful of the bot's finite context window. It's strongly recommended to break down tasks such as reading entire modules into smaller chunks. For a focused discussion, use review comments to chat about specific files and their changes, instead of using the PR comments. CodeRabbit Commands (Invoked using PR comments)
Other keywords and placeholders
Documentation and Community
|
There was a problem hiding this comment.
Actionable comments posted: 1
🧹 Nitpick comments (2)
apps/desktop/src/locales/ko/messages.po (1)
374-376: New translation entry added but untranslated.The "Auto (Default)" message has been added to the Korean translation file but remains untranslated (empty msgstr). This is expected for new strings.
Consider providing the Korean translation for "Auto (Default)" if localization is needed for this feature.
apps/desktop/src/components/editor-area/note-header/listen-button.tsx (1)
294-304: Consider optimizing query refetch behavior.The queries have
refetchOnWindowFocus: truewhich might cause unnecessary refetches. Consider if this is needed for the template selection feature.If the templates and config don't change frequently, you might want to remove
refetchOnWindowFocus: trueto reduce unnecessary network calls:const configQuery = useQuery({ queryKey: ["config"], queryFn: () => dbCommands.getConfig(), - refetchOnWindowFocus: true, }); const templatesQuery = useQuery({ queryKey: ["templates"], queryFn: () => dbCommands.listTemplates(), - refetchOnWindowFocus: true, });
📜 Review details
Configuration used: .coderabbit.yaml
Review profile: CHILL
Plan: Pro
📒 Files selected for processing (7)
apps/desktop/src/components/editor-area/floating-button.tsx(0 hunks)apps/desktop/src/components/editor-area/index.tsx(6 hunks)apps/desktop/src/components/editor-area/note-header/listen-button.tsx(8 hunks)apps/desktop/src/locales/en/messages.po(10 hunks)apps/desktop/src/locales/ko/messages.po(10 hunks)apps/docs/data/i18n.json(1 hunks)packages/utils/src/stores/ongoing-session.ts(3 hunks)
💤 Files with no reviewable changes (1)
- apps/desktop/src/components/editor-area/floating-button.tsx
🧰 Additional context used
📓 Path-based instructions (1)
`**/*.{js,ts,tsx,rs}`: 1. No error handling. 2. No unused imports, variables, or functions. 3. For comments, keep it minimal. It should be about "Why", not "What".
**/*.{js,ts,tsx,rs}: 1. No error handling.
2. No unused imports, variables, or functions.
3. For comments, keep it minimal. It should be about "Why", not "What".
⚙️ Source: CodeRabbit Configuration File
List of files the instruction was applied to:
packages/utils/src/stores/ongoing-session.tsapps/desktop/src/components/editor-area/note-header/listen-button.tsxapps/desktop/src/components/editor-area/index.tsx
🧬 Code Graph Analysis (1)
apps/desktop/src/components/editor-area/note-header/listen-button.tsx (3)
packages/ui/src/components/ui/popover.tsx (1)
Popover(85-85)packages/utils/src/contexts/ongoing-session.tsx (1)
useOngoingSession(32-46)packages/ui/src/components/ui/select.tsx (5)
Select(174-174)SelectTrigger(174-174)SelectValue(174-174)SelectContent(174-174)SelectItem(174-174)
🪛 GitHub Actions: .github/workflows/i18n.yaml
apps/docs/data/i18n.json
[error] 1-1: i18n data is not up-to-date. Please run 'task i18n' locally and commit the changes.
⏰ Context from checks skipped due to timeout of 90000ms. You can increase the timeout in your CodeRabbit configuration to a maximum of 15 minutes (900000ms). (2)
- GitHub Check: ci (windows, windows-latest)
- GitHub Check: ci (macos, macos-latest)
🔇 Additional comments (25)
packages/utils/src/stores/ongoing-session.ts (4)
16-16: Clean state property addition for template selection.The
autoEnhanceTemplateproperty is properly typed and follows the existing store pattern.
23-23: Action signature matches the expected pattern.The
setAutoEnhanceTemplateaction is correctly typed and follows the store's naming conventions.
38-38: Appropriate initial state value.Setting the initial value to
nullis correct for optional template selection.
67-73: Proper implementation following store patterns.The
setAutoEnhanceTemplateimplementation correctly uses mutative for immutable updates and follows the existing pattern in the store.apps/desktop/src/locales/en/messages.po (1)
374-376: New translation entry added correctly.The "Auto (Default)" message has been properly added with the correct source reference and translation string.
apps/desktop/src/components/editor-area/note-header/listen-button.tsx (10)
9-9: New imports correctly added for template selection feature.The database commands and Select UI components are properly imported and used throughout the component.
Also applies to: 14-14
227-227: Proper integration with ongoing session store.The
setAutoEnhanceTemplateaction is correctly destructured and used to persist template selection.
230-230: Good popover state management.Adding controlled state for the popover improves the user experience by allowing programmatic control.
237-248: Well-implemented template handling in stop session.The
handleStopSessionfunction correctly accepts an optional template ID and sets it in the store before stopping the session.
251-251: Appropriate change to controlled popover.Converting from uncontrolled to controlled popover enables better state management and user experience.
284-284: Proper state initialization for template selection.The
selectedTemplatestate is appropriately initialized to "auto" as the default value.
306-312: Correct synchronization with config data.The useEffect properly syncs the selected template with the stored configuration, with appropriate fallback to "auto".
314-317: Clean template ID conversion logic.The
handleStopWithTemplatefunction correctly converts "auto" to null for the API call.
334-350: Well-implemented template selection UI.The Select component implementation is clean and properly handles the template options with appropriate fallback display.
363-363: Correct integration of template selection with stop action.The stop button now properly calls
handleStopWithTemplateto include the selected template in the stop action.apps/desktop/src/components/editor-area/index.tsx (10)
92-93: LGTM!The mutation hook definition is correct and follows the established pattern.
116-119: Clean refactoring to explicit template ID passing.The callback correctly handles the "auto" template case and passes both the template ID and trigger type explicitly to the mutation.
122-123: Good simplification of the manual enhance trigger.The callback correctly relies on the mutation's default behavior for template selection.
249-255: Well-designed API with proper defaults.The object parameter pattern provides clarity and extensibility, while the default value maintains backward compatibility.
286-291: Verify the null template handling is intentional.When
templateIdis explicitlynull(from the "auto" template case), it won't fall back to the config's selected template. Please confirm this is the intended behavior for auto-enhancement.
296-298: Correct usage of the resolved template ID.The template lookup properly uses the effective template ID determined by the fallback logic.
503-503: Type signature correctly updated.The parameter type matches the updated mutation function signature.
506-507: Proper integration with ongoing session store.The hook correctly retrieves the auto-enhance template state and its setter.
518-527: Good implementation of one-time template usage.The code correctly applies the selected template during auto-enhancement and clears it afterward, preventing unintended reuse in subsequent sessions.
534-536: Dependency array correctly updated.All referenced variables are properly included in the effect dependencies.
| "total": 283, | ||
| "missing": 283 |
There was a problem hiding this comment.
Address the i18n pipeline failure.
The translation counts have been updated correctly to reflect the new "Auto (Default)" message, but the pipeline failure indicates the i18n data needs to be regenerated.
Please run task i18n locally and commit the changes to fix the pipeline failure as indicated in the GitHub Actions workflow.
🤖 Prompt for AI Agents
In apps/docs/data/i18n.json around lines 4 to 5, the translation counts are
updated but the i18n pipeline fails because the i18n data is not fully
regenerated. To fix this, run the `task i18n` command locally to regenerate the
i18n data files completely, then commit the updated files to resolve the
pipeline failure.
No description provided.